<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('案例字段列表')" />
	<th:block th:include="include :: layout-latest-css" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
	 <div class="ui-layout-west">
		<div class="main-content">
			<div class="box box-main">
				<div class="box-header">
					<div class="box-title">
						<i class="fa icon-grid"></i> 案例设置
					</div>
					<div class="box-tools pull-right">
						<!--<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="autoCase()" title="编辑"><i class="fa fa-edit"></i></a>-->
						<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
						<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
						<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新"><i class="fa fa-refresh"></i></button>
					</div>
				</div>
				<div class="ui-layout-content">
					<div id="tree" class="ztree"></div>
				</div>
			</div>
		</div>
	 </div>


     <div class="container-div ui-layout-center">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								案例编号：<input type="text" th:value="${caseNo}" name="caseNo" id="caseNo"/>
							</li>

							<li>
								案例请求编号：<input type="text"  name="caseRequestSeq" id="caseRequestSeq"/>
							</li>


							<li>
								执行条件 0：执行 其他：不执行：<input type="text" name="condition"/>
							</li>

							<li>
								优先执行环境 0默认 1spx 2cpack 3t2 4kesb 5hr：<input type="text" name="firstSetting"/>
							</li>


							<li>
								参数配置 1入参 2返回首包 3返回后续包：<input type="text" name="runType"/>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:newCaseSeq:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:newCaseSeq:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:newCaseSeq:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:newCaseSeq:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
	 <th:block th:include="include :: footer" />
	 <th:block th:include="include :: layout-latest-js" />
	 <th:block th:include="include :: ztree-js" />

    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:newCaseSeq:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:newCaseSeq:remove')}]];
        var prefix = ctx + "system/newCaseSeq";

        $(function() {
			var panehHidden = false;
			if ($(this).width() < 769) {
				panehHidden = true;
			}
			$('body').layout({ initClosed: panehHidden, west__size: 300 });
			queryCaseNoTree();
			queryRequest();

		});

        function queryRequest() {
			var options = {
				url: prefix + "/listDetail",
				createUrl: prefix + "/add",
				updateUrl: prefix + "/edit/{id}",
				removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
				modalName: "案例字段",
				showExport: true,
				columns: [{
					checkbox: true
				},
					{
						field : 'case_detail_id',
						title : '详情编号',
						visible: false
					},
					{
						field : 'caseNo',
						title : '案例编号',
						visible: false
					},
					{
						field : 'caseRequestSeq',
						title : '内部序号',
						visible: false
					},
					{
						field : 'request_item_no',
						title : '域',
					},
					{
						field : 'request_item',
						title : '名称',
					},
					{
						field : 'request_item_value',
						title : '值',
					},
					{
						field : 'run_type',
						title : '参数配置',
					},

					{
						title: '操作',
						align: 'center',
						formatter: function(value, row, index) {
							var actions = [];
							actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.caseNo + '\')"><i class="fa fa-edit"></i>编辑</a> ');
							actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.caseNo + '\')"><i class="fa fa-remove"></i>删除</a>');
							return actions.join('');
						}
					}]
			};
			$.table.init(options);



		}





		function queryCaseNoTree()
		{
			var caseNo=$("#caseNo").val();
			var url = ctx + "system/newCaseSeq/treeData/"+caseNo;
			var options = {
				url: url,
				expandLevel: 1,
				onClick : zOnClick
			};
			$.tree.init(options);
			function zOnClick(event, treeId, treeNode) {
				$("#caseNo").val(treeNode.pId);
				$("#caseRequestSeq").val(treeNode.id);
				$.table.search();
			}
		}

		$('#btnExpand').click(function() {
			$._tree.expandAll(true);
			$(this).hide();
			$('#btnCollapse').show();
		});

		$('#btnCollapse').click(function() {
			$._tree.expandAll(false);
			$(this).hide();
			$('#btnExpand').show();
		});

		$('#btnRefresh').click(function() {
			queryCaseNoTree();
		});






    </script>
</body>
</html>